package org.xiaojinlong.exam;

import java.util.Scanner;

/**
 * @author Jin Long
 *         2015/10/16
 */
public class LK01 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            int n = scanner.nextInt();
            int m = scanner.nextInt();
            int t1 = scanner.nextInt();
            int t2 = scanner.nextInt();
            int t3 = scanner.nextInt();
            int t4 = scanner.nextInt();

            if (m >= n) {
                int min = (n - 1) * t4;
                for (int i = 2; i <= n; i++) {
                    int lift1 = (m - i) * t1 + t2;
                    int man = (n - i) * t4;
                    int max = lift1 > man ? lift1 : man;
                    int mix = (i - 1) * t1 + t2 + t3 + max;
                    if (mix < min) min = mix;
                }
                System.out.println(min);
            } else {
                int min = (n - 1) * t4;
                for (int i = m; i <= n; i++) {
                    int lift1 = (i - m) * t1 + t2; // 电梯上去到及开门
                    int man = (n - i) * t4;
                    int max = lift1 > man ? lift1 : man; // 取下楼和电梯上去的最大时间
                    int mix = (i - 1) * t1 + t2 + t3 + max; // 总时间
                    if (mix < min) min = mix;
                }
                System.out.println(min);
            }
        }
    }
}
